<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>档案门类信息设置</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <link rel="stylesheet" href="../js/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../style/admin.css" media="all"/>
    <link rel="stylesheet" href="../style/home.css" media="all"/>
    <script src="../js/layui/layui.js"></script>
    <style>
        .layui-form-item .layui-inline {
            padding-right: 0px;
            margin-right: 0px;
        }

        body {
            background-color: #fff;
            width: 100%;
            height: 100%;
            margin: 0px;
            padding: 0px;
            border: 0px;
        }
    </style>
</head>
<body layadmin-themealias="default">
<div class="" style="padding: 20px">
    <div class="layui-row layui-col-space15">
        <div class="layui-card pr20">
            <form class="layui-form" lay-filter="postData" action="" id="postData">
                <input type="hidden" name="id" value="put" th:value="${data.id}"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">档案类别</label>
                    <div class="layui-input-block">
                        <select name="archivesModel" lay-filter="archivesModel" id="archivesModel" required
                                lay-verify="required">
                            <option value=""></option>
                            <option value="0" th:selected="${data.archivesModel eq '0'}">文书档案</option>
                            <option value="1" th:selected="${data.archivesModel eq '1'}">科技档案</option>
                            <option value="2" th:selected="${data.archivesModel eq '2'}">诉讼档案</option>
                            <option value="3" th:selected="${data.archivesModel eq '3'}">业务档案</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">归档模式</label>
                    <div class="layui-input-block">
                        <select name="fillingModel" lay-filter="fillingModel" id="fillingModel" required
                                lay-verify="required">
                            <option value=""></option>
                            <option value="1" th:selected="${data.fillingModel eq '1'}">文件级目录</option>
                            <option value="2" th:selected="${data.fillingModel eq '2'}">案卷级目录</option>
                            <option value="3" th:selected="${data.fillingModel eq '3'}">项目级目录</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">门类名称</label>
                    <div class="layui-input-block">
                        <input
                                type="text"
                                name="classifyName"
                                placeholder="请输入门类名称"
                                autocomplete="off"
                                class="layui-input"
                                required
                                lay-verify="required"
                                th:value="${data.classifyName}"
                        />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <textarea name="remark" placeholder="请输入内容" class="layui-textarea"
                                  th:text="${data.remark}"></textarea>
                    </div>
                </div>
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="postData" id="postBut"
                        style="display: none">
                    立即提交
                </button>
            </form>
        </div>
    </div>
</div>
<script>
    var form = layui.form;
    var $ = layui.$;
    var callBackReturn = false;
    var index = parent.layer.getFrameIndex(window.name);
    form.render(null, 'postData');

    form.on('submit(postData)', function (obj) {
        var data = obj.field;
        $.ajax({
            url: './saveClassifyData', //url
            contentType: 'application/json',
            dataType: 'json', //数据格式
            type: 'POST', //请求方式
            async: false, //是否异步请求
            data: JSON.stringify(data),
            success: function (result) {
                if (result.code == 0) {
                    parent.layer.msg(result.message, {icon: 1});
                    callBackReturn = true;
                    parent.layer.close(index);
                } else {
                    parent.layer.alert(result.message, {icon: 2});
                }
            },
        });
        return false;
    });

    function Buttun_Submit() {
        document.getElementById('postBut').click();
        return callBackReturn;
    }
</script>
<script type="text/javascript" src="../js/lib/watermark.js"></script>
</body>
</html>